home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / applications / wp / mced-1.1.lha / CEDScripts / Undo.ced < prev   
Encoding:
Text File  |  1992-09-02  |  1.3 KB  |  55 lines

  1. /*
  2. **    Undo.ced
  3. **    
  4. **    $VER: Undo.ced 1.1 (1.2.95)
  5. **    
  6. **    This script undoes the result of last CEd script execution or just last
  7. **    change if no script has been run.
  8. **    For more info see docs.
  9. **    
  10. **    Copyright © 1995 Michael Letowski
  11. */
  12.  
  13. /* Get host */
  14. PARSE SOURCE com res called resolved ext host .
  15. IF host="REXX" THEN                                                /* From command line */
  16.     ADDRESS "rexx_ced"                                            /* Talk to default ced */
  17.  
  18. OPTIONS RESULTS                                                        /* Enable results */
  19.  
  20. ClipName=UndoClipName()                                        /* Get clip name for current file */
  21.  
  22. Res=GetClip(ClipName)                                            /* Get number of undoes */
  23. IF Res='' THEN                                                        /* Clip not set */
  24. DO
  25.     CALL Undo()                                                            /* Just Undo */
  26.     EXIT
  27. END
  28. IF Res<=0 THEN                                                        /* Already undone */
  29.     CALL Err()
  30.  
  31. 'DM "Undoing..."'                                                    /* Change status bar */
  32.  
  33. CALL SetClip(ClipName,-Res)                                /* Mark 'undone' status */
  34. DO FOR Res
  35.     CALL Undo()                                                            /* Undo one change */
  36. END
  37.  
  38. 'DM'                                                                            /* Restore status line */
  39. EXIT
  40.  
  41. UndoClipName:
  42.     'Status FILEMEM'                                                /* Get address of current file */
  43. RETURN "CEDUndo."Right(D2X(RESULT),8,"0")    /* Prepare unique name */
  44.  
  45. Undo:
  46.     'Undo'                                                                    /* Do operation */
  47.     IF ~RESULT THEN                                                    /* Undo failed */
  48.         CALL Err()                                                        /* Inform user */
  49. RETURN    
  50.  
  51. Err:
  52.     'DM'                                                                        /* Restore status bar */
  53.     'Okay1' "Nothing more to undo."
  54. EXIT
  55.